#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int majorityElement(int* nums, int numsSize)
{
	int i = 0, count = 0;
	int index = nums[i];
	for (i = 0; i < numsSize; i++)
	{
		if (nums[i] == index)
		{
			count++;
		}
		else
		{
			count--;
			if (count == 0)
				index = nums[i + 1];
		}
	}

	return index;
}
